package com.margo.project.web.schedule;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
import org.springframework.stereotype.Component;

@Component
@ConditionalOnBean(name="taskScheduler")
public class MargoSchedulingConfigurer implements SchedulingConfigurer{

	private final Logger logger=LoggerFactory.getLogger(MargoSchedulingConfigurer.class);
	
	@Autowired
	private TaskScheduler taskScheduler;
	
	@Override
	public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
		logger.info("配置taskScheduler");
		taskRegistrar.setTaskScheduler(taskScheduler);
	}
	

}
